home *** CD-ROM | disk | FTP | other *** search
- ; FILE: MICROPCX.ASM
- ; DESCRIPTION: a PCX µviewer.
- ; HARDWARE REQUIREMENTS: PC compatible & VGA.
- ; Power supply strongly recommended.
- ;
- ; This µviewer displays only 320x200x256 pcx files, but it is the shortest
- ; pcx viewer in the whole fuckin' world (185 bytes .com executable included).
- ; Warning: If this pro does not work with a certain 320x200x256 pcx, it may be
- ; caused by that one byte before palette data at the end of that pcx file. I do
- ; not know what this byte means, so I just skip it. And it makes my viewer a
- ; bit shorter :). If you find a 320x200x256 pcx which this program doesn't
- ; work with, or if you know how to interpret this mysterious byte, report via
- ; email to: mgoleb@iec.tup.edu.pl
- ; Copying policy: this is Public Domain so you can use it, and copy it,
- ; as long as you wish. I am not responsible for any damages caused by
- ; using this program.
- ; Admire, enjoy and learn! :-)
- ; Try to beat me & make a shorter one, if you dare!
- ; Greets go to Mike, Andrew, Melon, Tommy J. aka Modul, and Demonews magazine
- ; editors!
- ; (C) 1994 by Lord Debugger. Poznan, Poland.
- ;
- ; P.S. The code is not documented because:
- ; 1.) IMHO it is selfdocumenting :)
- ; 2.) If it was hard to write, it should be hard to read :) (that is not
- ; my idea, but I like it)
- ; C ya on the Net and have a nice os, guys!
-
- cseg SEGMENT PARA PUBLIC 'CODE'
-
- ASSUME cs:cseg, ds:cseg
-
- org 100H
- Start:
- xor ax, ax
- mov al, [byte ptr es:80h]
- inc al
- mov bx, 80h
- add bx, ax
- mov byte ptr [es:bx], 0
- mov ax, 0013h
- int 10h
- mov ax, 3D00H
- mov dx, 82h
- int 21H
- mov fhand, ax
-
- mov di, 128
- move128:
- call getbyte
- dec di
- jnz move128
-
- mov bx, 0A000h
- mov es, bx
- xor di, di
- ldlp1:
- call getbyte
- and ax, 0C0h
- cmp ax, 0C0h
- jne single
- mov al, bufor
- and ax, 3Fh
- push ax
- call getbyte
- pop cx
- ldlp2: rep stosb
- jmp short cnt
- single:
- mov al, bufor
- stosb
- cnt:
- cmp di, 64001
- jb ldlp1
-
- mov cx, 768
- push di
- lpal:
- push cx
- call getbyte
- stosb
- pop cx
- loop lpal
- pop di
-
- push ds
- push es
- pop ds
- mov dx, di
- mov si, di
- mov cx, 768
- set256:
- lodsb
- shr al, 1
- shr al, 1
- stosb
- loop set256
- pop ds
- mov ax, 1012h
- xor bx, bx
- mov cx, 256
- int 10h
-
- mov ah, 3Eh
- mov bx, fhand
- int 21h
-
- mov ax, 0C06H
- mov dx, 00FFH
- int 21H
- lpwk:
- mov ax, 0600H
- mov dx, 00FFH
- int 21H
- jz lpwk
- mov ax, 0C06H
- mov dx, 00FFH
- int 21H
-
- mov ax, 0003h
- int 10h
- ret
-
- getbyte PROC NEAR
- mov ah, 3Fh
- mov bx, fhand
- mov cx, 1
- lea dx, bufor
- int 21h
- mov al, bufor
- ret
- getbyte ENDP
-
- fhand dw ?
- bufor db ?
-
- cseg ENDS
-
- END Start
-